import 'package:flutter/material.dart';

import 'package:get/get.dart';

import '../../../../components/buttom12/salomon_bottom_bar.dart';
import '../controllers/bottom12_controller.dart';

class Bottom12View extends GetView<Bottom12Controller> {
  const Bottom12View({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('salomon底部导航'),
        elevation: 0,
        centerTitle: true,
      ),
      backgroundColor: Colors.grey[200],
      body: content(),
      bottomNavigationBar: Obx(() {
        return Container(
          color: Colors.white,
          child: SafeArea(
            bottom: true,
            child: SalomonBottomBar(
              currentIndex: controller.currentIndex.value,
              onTap: (i) => controller.setCurrentIndex(i),
              items: [
                /// Home
                SalomonBottomBarItem(
                  icon: const Icon(Icons.home),
                  title: const Text("Home"),
                  selectedColor: Colors.purple,
                ),

                /// Likes
                SalomonBottomBarItem(
                  icon: const Icon(Icons.favorite_border),
                  title: const Text("Likes"),
                  selectedColor: Colors.pink,
                ),

                /// Search
                SalomonBottomBarItem(
                  icon: const Icon(Icons.search),
                  title: const Text("Search"),
                  selectedColor: Colors.orange,
                ),

                /// Profile
                SalomonBottomBarItem(
                  icon: const Icon(Icons.person),
                  title: const Text("Profile"),
                  selectedColor: Colors.teal,
                ),
              ],
            ),
          ),
        );
      }),
    );
  }

  Widget content() {
    return Obx(() {
      return Container(
        alignment: Alignment.center,
        child: Text(controller.currentIndex.toString(),
            style: TextStyle(color: Colors.grey[400], fontSize: 80)),
      );
    });
  }
}
